package mn.idax.exchange.otc.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import mn.idax.exchange.common.bean.IdaxBase;

/**
 * @Author: jack_huang
 * @Date: 2019/5/27 16:14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class MessageDTO extends IdaxBase  implements Comparable<MessageDTO>{
    private static final long serialVersionUID = -5747462350861834450L;


    /**
     * 消息唯一标识
     */
    private String messageId;

    /**
     * 消息内容
     */
    private String message;

    /**
     * 0默认未读 1 已读
     */
    private Integer readFlag;

    /**
     * 身份标识 买/卖家（1,2）  自己系统消息中值=0
     */
    private Integer identityFlag;

    /**
     * 订单的一些信息
     */
    private String orderNum;

    /**
     * 业务码 app 拿业务码跳转
     */
    private Integer business;

    /**
     * 存储的地方 0 mongo 1 db
     */
    private Integer saveArea;

    /**
     * 发送时间
     */
    private String sendTime;
    /**
     * 发送人头像
     */
    private String userLogo;


    @Override
    public int compareTo(MessageDTO o) {

        int sort = this.getReadFlag() - (o.getReadFlag());
        if(sort == 0){

            return o.getSendTime().compareTo(this.getSendTime());
        } else {
            return sort;
        }
    }
}
